package com.sky.factory;

import java.util.Objects;
import java.util.Scanner;

/**
 * Created by Frank Lau on 2017/5/26 0026.
 */
public class calculator_1_0 {

    public static void main(String[] args) {
        System.out.println("請輸入數字A: ");
        Scanner scanner=new Scanner(System.in);
        String A = scanner.nextLine();
        System.out.println("請選擇運算符(+ - * /): ");
        String B = scanner.nextLine();
        System.out.println("請輸入數字C: ");
        String C = scanner.nextLine();
        String D;
        if (Objects.equals(B, "+")) {
            D = String.valueOf(Double.parseDouble(A) + Double.parseDouble(C));
            System.out.println(D);
        }
        if (Objects.equals(B, "-")) {
            D = String.valueOf(Double.parseDouble(A) - Double.parseDouble(C));
            System.out.println(D);
        }
        if (Objects.equals(B, "*")) {
            D = String.valueOf(Double.parseDouble(A) * Double.parseDouble(C));
            System.out.println(D);
        }
        if (Objects.equals(B, "/")) {
            D = String.valueOf(Double.parseDouble(A) / Double.parseDouble(C));
            System.out.println(D);
        }
    }
}
